package com.lyf.viewapp;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lyf.viewapp.animations.AnimationsMainActivity;
import com.lyf.viewapp.base.BaseActivity;
import com.lyf.viewapp.cards.CardSliderActivity;
import com.lyf.viewapp.cards.SwipeCardsActivity;
import com.lyf.viewapp.cards.zlayout.ZLayoutManagerActivity;
import com.lyf.viewapp.category.CategoryMainActivity;
import com.lyf.viewapp.chart.LineChartActivity;
import com.lyf.viewapp.chart.PieChartActivity;
import com.lyf.viewapp.dialog.DialogMainActivity;
import com.lyf.viewapp.gps.GpsMainActivity;
import com.lyf.viewapp.list.ListMainActivity;
import com.lyf.viewapp.list.one.MultiSelectActivity;
import com.lyf.viewapp.multimedia.MultiMediaMainActivity;
import com.lyf.viewapp.nfc.NfcMainActivity;
import com.lyf.viewapp.other.OtherMainActivity;
import com.lyf.viewapp.picture.PictureMainActivity;
import com.lyf.viewapp.tab.TabMainActivity;
import com.lyf.viewapp.util.EnterBean;
import com.lyf.viewapp.util.EnterRecyclerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends BaseActivity {

    @BindView(R.id.main_list)
    RecyclerView recyclerView;

    private List<EnterBean> list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        list = new ArrayList<>();
        initDate();

    }

    private void initDate() {
        list.add(new EnterBean("Multi-Media", MultiMediaMainActivity.class));
        list.add(new EnterBean("PieChart", PieChartActivity.class));
        list.add(new EnterBean("LineChart", LineChartActivity.class));
        list.add(new EnterBean("SwipeCards", SwipeCardsActivity.class));
        list.add(new EnterBean("CardSlider", CardSliderActivity.class));
        list.add(new EnterBean("ZLayoutManager", ZLayoutManagerActivity.class));
        list.add(new EnterBean("MultiSelect", MultiSelectActivity.class));
        list.add(new EnterBean("ListView", ListMainActivity.class));
        list.add(new EnterBean("Animations", AnimationsMainActivity.class));
        list.add(new EnterBean("Picture", PictureMainActivity.class));
        list.add(new EnterBean("Dialog", DialogMainActivity.class));
        list.add(new EnterBean("Category", CategoryMainActivity.class));
        list.add(new EnterBean("GPS", GpsMainActivity.class));
        list.add(new EnterBean("TAB", TabMainActivity.class));
        list.add(new EnterBean("DownFile", com.lyf.viewapp.downfile.MainActivity.class));
        list.add(new EnterBean("NFC", NfcMainActivity.class));
        list.add(new EnterBean("Other", OtherMainActivity.class));

        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        EnterRecyclerAdapter adapter = new EnterRecyclerAdapter(R.layout.main_item,list);
        adapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_LEFT);
        recyclerView.setAdapter(adapter);
        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Intent intent = new Intent(MainActivity.this, list.get(position).getActivity());
                startActivity(intent);
            }
        });
    }
}
